home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MATH.SWG / 0006_GCD.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  277b  |  25 lines

  1. {Greatest common divisor}
  2. Program GCD;
  3.  
  4. Var
  5.   x, y : Integer;
  6.  
  7. begin
  8.   read(x);
  9.  
  10.   While x <> 0 do
  11.   begin
  12.     read(y);
  13.  
  14.     While x <> y do
  15.       if x > y then
  16.         x := x - y
  17.       else
  18.         y := y - x;
  19.  
  20.     Write(x);
  21.     read(x);
  22.  
  23.   end;
  24. end.
  25.